#!/usr/bin/env python
# -*- conding : UTF-8 -*-
import sys, os
def conv( imgn ):
	imgne = os.path.abspath( imgn )
	imgnen = os.path.splitext( imgn )[0] + ".jpg"
#	os.system("echo " + imgne + "&&" + "echo " + imgnen)
	os.system("convert " + imgne + " -format jpg -quality 70 " + imgnen)
def main():
	smv = 0
	if len(sys.argv) == 1:
		print "type convimg help for more help"
	elif sys.argv[1] == "help":
		print """convert image to jpg or png"""
	else:
		for i in sys.argv[1:] :
			conv(i)
			print os.path.basename(i),
			print "Convert Finish!!!"
			smv+=1
	return smv
if __name__ == "__main__":
	print '!!!  Under GPL  !!!\nWritten\
	by RAh-XePhON \n @ http://ToKyo-JuPiTer.Blogspot.com/'
	print main(),
	print "Images Convert!"
	print 'Exit'
	sys.exit(0)
